{// 引入标签库 }

<tagLib name="fanwe" />

<include file="Public:header" />

<load href="__TMPL__ThemeFiles/Js/jquery.js" />

<load href="__TMPL__ThemeFiles/Js/jquery.json.js" />

<load href="__TMPL__ThemeFiles/Js/tabs.js" />

<script type="text/javascript" src="__TMPL__ThemeFiles/Js/calendar.php?lang=zh-cn" ></script>

<load href='__TMPL__ThemeFiles/Js/calendar/calendar.css' />

<load href='__TMPL__ThemeFiles/Js/goods.js' />

<load href='__TMPL__ThemeFiles/Js/swfupload/swfupload.js' />

<load href='__TMPL__ThemeFiles/Js/swfupload/goodsupload/swfupload.queue.js' />

<load href='__TMPL__ThemeFiles/Js/swfupload/goodsupload/fileprogress.js' />

<load href='__TMPL__ThemeFiles/Js/swfupload/goodsupload/handlers.js' />

<load href="__TMPL__ThemeFiles/Js/jquery.bgiframe.js" />

<load href="__TMPL__ThemeFiles/Js/model.js" />

<script src="http://ditu.google.cn/maps?file=api&amp;v=2&amp;sensor=true&amp;key={:fanweC('GOOGLE_MAP_KEY')}" type="text/javascript"></script>

<script type="text/javascript">

var goods_id = {$goods_id};

var session_id = '{$session_id}';

var ATTR_TIPS = '{%ATTR_TIPS}';

var MAX_UPLOAD = '<php>echo (fanweC('MAX_UPLOAD')/1000000)."MB";</php>';

var MAX_UPLOAD_TIP = "{$Think.lang.GOODS_UPLOAD_MAX_TIP}<php>echo (fanweC('MAX_UPLOAD')/1000000)."MB";</php>";

var EDIT_SUCCESS = '{%EDIT_SUCCESS}';

var SELECT_SPEC_TYPE = '=={%SELECT_SPEC_TYPE}==';



var GOODS_SPEC_ITEM_EXIST = '{%GOODS_SPEC_ITEM_EXIST}';

var EXIST_SAME_SPEC = '{%EXIST_SAME_SPEC}';

var CLOSE = '{%CLOSE}';

var DEFAULT_LANG_ID = '{$DEFAULT_LANG_ID}';

</script>





<div id="main" class="main" >

<div class="content">

<div class="title">{$Think.lang.EDIT_DATA} </div>

<div id="result" class="result none"></div>

<form method='post' id="form" name="form" action="{:u('Goods/update')}"  enctype="multipart/form-data">

<ul class="conf_btns">
	<li>团购信息</li>
	<li>团购详细</li>
	<li>商家信息</li>
    <li id="areaSetting">商圈信息</li>
</ul>

<div class="conf_tabs">

<table cellpadding="0" cellspacing="0" width=100% class="conf_table dataEdit">

	<tr>

		<td valign="top">

		<!-- 普通信息 -->

		<table cellpadding=0 cellspacing=0 class="dataEdit">

		<tr>

			<td class="tRight" width="120">{$Think.lang.GOODS_NAME}：</td>

			<td class="tLeft" >

				<fanwe:textbox name="name" class="bLeftRequire" />

			</td>

		</tr>

		<tr>

			<td class="tRight">{$Think.lang.SITE_ID}：</td>

			<td class="tLeft" >

				<select id="site_id" name="site_id" class="bLeftRequire">

					<option value="{$site.id}" selected>{$site.name}</option>	

				</select>

                <input type="text" name="siteKey" id="siteKey" class="site-key" style="width:80px;" value="" />&nbsp;

        		<input type="button" class="search-site" value="{$Think.lang._SEARCH_DATA}" style="cursor:pointer;" onclick="$.searchSite('#siteKey','#site_id');" />

			</td>

		</tr>

        <tr>

			<td class="tRight">{$Think.lang.CATE_ID}：</td>

			<td class="tLeft" >

				<select name="cate_id" id="cate_id">

                    <foreach name="goodsCates" item="cate">

                    <option value="{$cate.id}" <if condition="$cate['id'] eq $vo['cate_id']">selected</if>>{$cate.name}</value>

                    </foreach>

                </select>

			</td>

		</tr>

       <tr>

			<td class="tRight" width="120">{$Think.lang.URL}：</td>

			<td class="tLeft" >

				<input type="text" name="url" class="bLeftRequire" style="width:90%;" value="{$vo.url}" />

			</td>

		</tr>

		<tr>

			<td class="tRight" width="120">{$Think.lang.CITY}：</td>

			<td class="tLeft" >

				<select name="city" id="city">

                    <foreach name="group_city_list" item="group_city">

                    <option value="{$group_city.name}" <if condition="$group_city['name'] eq $vo['city']">selected</if> cityID="{$group_city.id}">{$group_city.name}</value>

                    </foreach>

                </select>

			</td>

		</tr>

        <tr>

			<td class="tRight" width="120">{$Think.lang.SMALL_IMG}：</td>

			<td class="tLeft" >

				<input type="text" name="small_img_url" class="bLeft" />

			</td>

		</tr>

        <tr>

			<td class="tRight" width="120">&nbsp;</td>

			<td class="tLeft" >

				{$Think.lang.SMALL_IMG_DESC}

			</td>

		</tr>

		<!-- 价格体系 -->

		<tr>

			<td class="tRight">{$Think.lang.MARKET_PRICE}：</td>

			<td class="tLeft" >

				<input type="text" class="bLeft" name="market_price" value="{$vo.market_price|priceVal}" id="market_price" />

			</td>

		</tr>

		<tr>

			<td class="tRight">{$Think.lang.SHOP_PRICE}：</td>

			<td class="tLeft" >

				<input type="text" class="bLeft" name="shop_price" value="{$vo.shop_price|priceVal}" id="shop_price" />

			</td>

		</tr>

		<tr>

			<td class="tRight">已购人数：</td>

			<td class="tLeft" >

				<input type="text" class="bLeft" name="bought" value="{$vo.bought}" id="bought" />

			</td>

		</tr>
		<tr>

			<td class="tRight">开始时间：</td>

			<td class="tLeft" >

				<INPUT TYPE="text"  name="begin_time" id="begin_time"  class="bLeft" value="{$vo.begin_time|toDate='Y-m-d H:i:s'}">

				<input type="button" name="btn_begin_time" id="btn_begin_time" onclick="return showCalendar('begin_time', '%Y-%m-%d %H:%M:%S', false, false, 'btn_begin_time');" value="{$Think.lang.SELECT}" class="button"/>

			</td>

		</tr>
		<tr>

			<td class="tRight">{$Think.lang.END_TIME}：</td>

			<td class="tLeft" >

				<INPUT TYPE="text"  name="end_time" id="end_time"  class="bLeft" value="{$vo.end_time|toDate='Y-m-d H:i:s'}">

				<input type="button" name="btn_end_time" id="btn_end_time" onclick="return showCalendar('end_time', '%Y-%m-%d %H:%M:%S', false, false, 'btn_end_time');" value="{$Think.lang.SELECT}" class="button"/>

			</td>

		</tr>

        

        <tr>

			<td class="tRight">结束时间换算：</td>

			<td class="tLeft" >

				<input type="text" id="dConvs" value="0" style="width:30px" />天&nbsp;

                <input type="text" id="hConvs" value="0" style="width:30px" />小时&nbsp;

                <input type="text" id="mConvs" value="0" style="width:30px" />分&nbsp;

                <input type="text" id="sConvs" value="0" style="width:30px" />秒&nbsp;

                <input type="button" value="换算" id="timeConvs" onclick="$.timeConvs('#dConvs','#hConvs','#mConvs','#sConvs','#end_time');" />

			</td>

		</tr>

        

		<tr>

			<td class="tRight" width="120">{$Think.lang.SORT}：</td>

			<td class="tLeft" >

				<input type="text" name="sort" value="{$vo.sort}" class="bLeft" />

			</td>

		</tr>

        <tr>

			<td class="tRight" width="120">推荐：</td>

			<td class="tLeft" >

				<select name="is_best" id="is_best">

                    <option value="1" <if condition="1 eq $vo['is_best']">selected</if>>是</value>

                    <option value="0" <if condition="0 eq $vo['is_best']">selected</if>>否</value>

                </select>

			</td>

		</tr>	
                
		<tr>

			<td class="tRight" width="120">审核是否通过：</td>

			<td class="tLeft" >

				<select name="status" id="status">

                    <option value="1" <if condition="1 eq $vo['status']">selected</if>>是</value>

                    <option value="0" <if condition="0 eq $vo['status']">selected</if>>否</value>

                </select>				

			</td>

		</tr>

		</table>

		<!-- 普通信息 -->

		</td>

		<td valign="top" style="padding-left:50px;">

		<!-- 图片上传块 -->

		<TABLE cellpadding=3 cellspacing=3 class="dataEdit" >

		<tr>

			<td>

			<table>

				<tr>

					<td width="120">

						<div id="divStatus" style="display:none;"></div>

						<input id="btnCancel" type="hidden" />

						<span id="image_browse"></span>

					</td>

					<td>

						<div class="fieldset flash" id="fsUploadProgress" style="display:none;" ></div>

						<div id="uploaderimg"></div>

					</td>

				</tr>

			</table>

			</td>

		</tr>

		<tr>

			<td>

			<img src="<if condition="$vo['big_img']">{$vo.big_img}<else />__TMPL__ThemeFiles/Images/nopic.gif</if>" width="300" height="230" id="goods_img_box" />

			<input type="hidden" name="gallery_id" id="gallery_id" value="0" />

			</td>

		</tr>

		<tr>

			<td>

				<!-- 图片列表 -->

				<div id="gallery_list" class="gallery_list" >

					<if condition="$vo['big_img']">		

						<div>

							<input type='hidden' value='{$vo.id}' name='goodsimg[]' />

							<img class="selectborder" id="goodsimg" src='{$vo.small_img}'/><br /><a href='javascript:;' onclick='delgoods({$vo.id},this)'>{$Think.lang._DELETE_DATA}</a>

						</div>

					</if>			

				</div>

				<!-- 图片列表 -->

			</td>

		</tr>

		</TABLE>

		<script type="text/javascript">

		var settings = {

				flash_url : PUBLIC+"/Js/swfupload/swfupload.swf",

				upload_url: APP,				

				post_params: {"<php>echo C('VAR_MODULE');</php>":"Public","<php>echo C('VAR_ACTION');</php>":"uploadBatch","goods_id":goods_id,"session_id":session_id},

				file_size_limit : "<php>echo (fanweC('MAX_UPLOAD')/1000000)."MB";</php>",

				file_types : "*.jpg;*.gif",

				file_types_description : "{$Think.lang.GOODS_UPLOAD_MAX_TIP}<php>echo (fanweC('MAX_UPLOAD')/1000000)."MB";</php>",

				file_upload_limit : 100,

				file_queue_limit : 100,

				custom_settings : {

					progressTarget : "fsUploadProgress",

					cancelButtonId : "btnCancel"

				},

				debug: false,



				// Button settings

				button_image_url: PUBLIC+"/Images/uploadbtn.png",

				button_width: "100",

				button_height: "30",

				button_placeholder_id: "image_browse",



				

				// The event handler functions are defined in handlers.js

				file_queued_handler : fileQueued,

				file_queue_error_handler : fileQueueError,

				file_dialog_complete_handler : fileDialogComplete,

				upload_start_handler : uploadStart,

				upload_progress_handler : uploadProgress,

				upload_error_handler : uploadError,

				upload_success_handler : uploadSuccess,

				upload_complete_handler : uploadComplete,

				queue_complete_handler : queueComplete	// Queue plugin event

			};

			var swfu = new SWFUpload(settings);

		</script>

		<!-- 图片上传块 -->

		</td>

	</tr>

	<tr>

		<td colspan="2">

			<table cellpadding="0" cellspacing="0" width=100% class="dataEdit">

				<tr>

					<td class="tRight" width="120">团购提示：</td>

					<td class="tLeft" >
						<textarea name="brief" style="width:96%; height:100px">{$vo.brief}</textarea>
					</td>

				</tr>

			</table>

		</td>

	</tr>

</table>

<table cellpadding="0" cellspacing="0" width=100% class="conf_table dataEdit">

	<tr>

		<td>

			<fanwe:editor id="content" name="content" type="KindEditor"  style="width:100%;height:350px;visibility:hidden;" />

		</td>

	</tr>

</table>

<table cellpadding="0" cellspacing="0" width=100% class="conf_table dataEdit">

	<tr>

		<td>&nbsp;<a href="javascript:;" onclick="addSuppliers();">添加</a></td>

	</tr>

	<tr>

		<td id="suppliersList">

		<if condition="$suppliers_list">

		<foreach name="suppliers_list" item="suppliers_item" >

		<div>

			<table cellpadding="0" cellspacing="0" width=100% class="dataEdit">

				<tbody>

					<tr>

						<td class="tRight" width="30" style="text-align:center;"><a href="javascript:;" onclick="deleteSuppliers(this);">删除</a></td>

						<td class="tRight" width="80">商家名称：</td>

						<td class="tLeft" width="200"><input type="text" name="suppliers_name[]" class="bLeftRequire" style="width:200px;" value="{$suppliers_item.name}" /></td>

						<td class="tRight" width="80">商家地址：</td>

						<td class="tLeft"><input type="text" name="suppliers_address[]" class="bLeft" style="width:90%;" value="{$suppliers_item.address}" /></td>

						<td class="tRight" width="80">商家电话：</td>

						<td class="tLeft"><input type="text" name="suppliers_tel[]" class="bLeft" style="width:90%;" value="{$suppliers_item.tel}" /></td>

					</tr>

					<tr>

						<td class="tRight" width="30">&nbsp;</td>

						<td class="tRight" width="80">定位地址：</td>

						<td class="tLeft"><input type="text" name="suppliers_map_address[]" class="bLeft suppliers_map_address" style="width:150px;" value="{$suppliers_item.map_address}" />&nbsp;<input type="button" value="查询" onclick="getSuppliersPosition(this);"/></td>

						<td class="tRight" width="80">经度：</td>

						<td class="tLeft"><input type="text" name="suppliers_longitude[]" class="bLeftRequire longitude" style="width:90%;" value="{$suppliers_item.longitude}" /></td>

						<td class="tRight" width="80">纬度：</td>

						<td class="tLeft"><input type="text" name="suppliers_latitude[]" class="bLeftRequire latitude" style="width:90%;" value="{$suppliers_item.latitude}" /></td>

					</tr>
                                         

				</tbody>

			</table>

			<hr />

		</div>

		</foreach>

		<else/>

		<div>

			<table cellpadding="0" cellspacing="0" width=100% class="dataEdit">

				<tbody>

					<tr>

						<td class="tRight" width="30" style="text-align:center;"><a href="javascript:;" onclick="deleteSuppliers(this);">删除</a></td>

						<td class="tRight" width="80">商家名称：</td>

						<td class="tLeft" width="200"><input type="text" name="suppliers_name[]" class="bLeftRequire" style="width:200px;" value="{$suppliers_item.name}" /></td>

						<td class="tRight" width="80">商家地址：</td>

						<td class="tLeft"><input type="text" name="suppliers_address[]" class="bLeft" style="width:90%;" value="{$suppliers_item.name}" /></td>

						<td class="tRight" width="80">商家电话：</td>

						<td class="tLeft"><input type="text" name="suppliers_tel[]" class="bLeft" style="width:90%;" value="{$suppliers_item.tel}" /></td>

					</tr>

					<tr>

						<td class="tRight" width="30">&nbsp;</td>

						<td class="tRight" width="80">定位地址：</td>

						<td class="tLeft"><input type="text" name="suppliers_map_address[]" class="bLeft suppliers_map_address" style="width:150px;" value="{$suppliers_item.map_address}" />&nbsp;<input type="button" value="查询" onclick="getSuppliersPosition(this);"/></td>

						<td class="tRight" width="80">经度：</td>

						<td class="tLeft"><input type="text" name="suppliers_longitude[]" class="bLeftRequire longitude" style="width:90%;" value="{$suppliers_item.longitude}" /></td>

						<td class="tRight" width="80">纬度：</td>

						<td class="tLeft"><input type="text" name="suppliers_latitude[]" class="bLeftRequire latitude" style="width:90%;" value="{$suppliers_item.latitude}" /></td>

					</tr>
                                        
                                    

				</tbody>

			</table>

			<hr />

		</div>

		</if>

		</td>

	</tr>

</table>
<table cellpadding="0" cellspacing="0" width=100% class="conf_table dataEdit">

	<tr>

		<td>&nbsp;<a href="javascript:;" onclick="addAreas();">添加</a></td>

	</tr>
        
        <tr>

		<td id="areaList">
		<foreach name="area_list" item="area_item" >
		<div>
			<table cellpadding="0" cellspacing="0" width=100% class="dataEdit">
				<tbody>
					<tr>
						<td class="tRight" width="30" style="text-align:center;">
							<a href="javascript:;" onclick="deleteArea(this);">删除</a>
						</td>
						<td class="tRight" width="80">父商圈：</td>
						<td class="tLeft" width="160">
							<select name="parent_area[]" class="parent_area" onchange="getChildAreas(this)">
								<option value="">重新设置</option>
								<option value="{$area_item.parent_area}" selected="selected">{$area_item.parent_area}</option>
							</select>
						</td>
						<td class="tRight" width="80">子商圈：</td>
						<td class="tLeft" width="160">
							<select name="child_area[]" class="child_area" onchange="resetChildAreas(this)">
								<option value="">重新设置</option>
								<option value="{$area_item.child_area}" selected="selected">{$area_item.child_area}</option>
							</select>
						</td>
						<td>&nbsp;</td>
					</tr>
				</tbody>
			</table>
			<hr />
		</div>
        </foreach>
		</td>
	</tr>
</table>
</div>

<table width=100%>

<tr>

	<td>&nbsp;</td>

	<td class="center"><div style="width:85%;margin:5px">

	<input name="click_count" value="{$vo.click_count}" type="hidden" />

	<input name="id" id="goods_id" value="{$vo.id}" type="hidden" />

	<input type="submit" value="{$Think.lang.SAVE_DATA}"  class="button small"> <input type="reset" class="button small" onclick="resetEditor()" value="{$Think.lang.RESET_DATA}" > 

	</div></td>

</tr>

</table>

</form>

</div>

</div>

<div id="goodsSuppliersListHtml" style="display:none;">

<div>

	<table cellpadding="0" cellspacing="0" width=100% class="dataEdit">

		<tbody>

			<tr>

				<td class="tRight" width="30" style="text-align:center;"><a href="javascript:;" onclick="deleteSuppliers(this);">删除</a></td>

				<td class="tRight" width="80">商家名称：</td>

				<td class="tLeft" width="200"><input type="text" name="suppliers_name[]" class="bLeftRequire" style="width:200px;" value="" /></td>

				<td class="tRight" width="80">商家地址：</td>

				<td class="tLeft"><input type="text" name="suppliers_address[]" class="bLeft" style="width:90%;" value="" /></td>

				<td class="tRight" width="80">商家电话：</td>

				<td class="tLeft"><input type="text" name="suppliers_tel[]" class="bLeft" style="width:90%;" value="" /></td>

			</tr>

			<tr>

				<td class="tRight" width="30">&nbsp;</td>

				<td class="tRight" width="80">定位地址：</td>

				<td class="tLeft"><input type="text" name="suppliers_map_address[]" class="bLeft suppliers_map_address" style="width:150px;" value="" />&nbsp;<input type="button" value="查询" onclick="getSuppliersPosition(this);"/></td>

				<td class="tRight" width="80">经度：</td>

				<td class="tLeft"><input type="text" name="suppliers_longitude[]" class="bLeftRequire longitude" style="width:90%;" value="" /></td>

				<td class="tRight" width="80">纬度：</td>

				<td class="tLeft"><input type="text" name="suppliers_latitude[]" class="bLeftRequire latitude" style="width:90%;" value="" /></td>

			</tr>
                         

		</tbody>

	</table>
	<hr />
</div>
</div>
<div id="goodsAreaListHtml" style="display: none;">
    <div>
		<table cellpadding="0" cellspacing="0" width=100% class="dataEdit">
			<tbody>
				<tr>
					<td class="tRight" width="30" style="text-align:center;">
						<a href="javascript:;" onclick="deleteArea(this);">删除</a>
					</td>
					<td class="tRight" width="80">父商圈：</td>
					<td class="tLeft" width="160">
						<select name="parent_area[]" class="parent_area" onchange="getChildAreas(this)">
						</select>
					</td>
					<td class="tRight" width="80">子商圈：</td>
					<td class="tLeft" width="160">
						<select name="child_area[]" class="child_area">
						</select>
					</td>
					<td>&nbsp;</td>
				</tr>
			</tbody>
		</table>
		<hr />
    </div>
</div>